htaccess: only do [some lines of code] for one domain, no others.

Posted by Coronatus on Stack Overflow See other posts from Stack Overflow or by Coronatus
Published on 2010-04-07T22:25:41Z Indexed on 2010/04/07 22:53 UTC
Read the original article Hit count: 266

Say I have a htaccess file shared by "dev.server" and "server.site.com".

The first domain should allow all users to access it unchallenged (it only exists on my local development server).

The second domain I want to authenticate users with Apache (NOT by database).

The code to authenticate users is:

AuthType Basic
AuthName "Server Admin"
AuthUserFile "/path/to/passwd"
require valid-user

What I can't do is make those 4 lines only matter if the domain is "server.site.com". How can I do this?

I searched for something like <IfEnv HTTP_HOST "site.server.com"> but had no luck.

© Stack Overflow or respective owner

Related posts about apache

Related posts about .htaccess